"use strict"
const { segment } = require("icqq")
const { bot } = require("../index")

let Config = new class {
    constructor() {
        this.GroupId = [1 , ];//需要添加签到功能的群
        this.Sign_Words = ["签到","嗷呜"];//签到关键词
        this.Sign_Blacklist_Id = [1];//签到黑名单（即不允许签到的QQ号）
    }
    async sleep (ms) {
        return new Promise((resolve) => setTimeout(resolve, ms))
    }
}

//群内签到点赞
bot.on("message.group", async function Thumb_Up(msg) {
    let qq = Number(msg.user_id);
    if (Config.GroupId.includes(msg.group_id) && Config.Sign_Words.includes(msg.raw_message)) {
        try {
            if (Config.Sign_Blacklist_Id.includes(qq)) {
                msg.reply(`${msg.raw_message}失败`);
                return true;
            }
            else {
                let isSuccess = await bot.pickFriend(qq).thumbUp(20);
                console.log(isSuccess);
                if (isSuccess) {
                    msg.reply("已为你点赞20次，记得回赞哟", true);
                } else {
                    msg.reply("今日已经赞过了,请明天再来", true);
                }
                return true;
            }
        } catch (err) {
            msg.reply(`原因是\n${err}`, true)
        }
    }
})